# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=qtmir-git
_pkgname=qtmir
pkgver=r2374.f77ed5dd
pkgrel=3
pkgdesc='Qt platform abstraction (QPA) plugin for a Mir server'
url='https://github.com/ubports/qtmir'
arch=(x86_64 i686 armv7h aarch64)
license=(LGPL)
conflicts=(qtmir)
provides=(qtmir)
depends=(qt5-base qt5-quickcontrols qt5-sensors mir-git process-cpp ubuntu-app-launch-git gsettings-qt-git libqtdbustest-git libqtdbusmock-git content-hub-git url-dispatcher-git glm valgrind)
makedepends=(git cmake cmake-extras-git gtest)
source=('git+https://github.com/ubports/qtmir.git'
        'moc.patch'
        'nowerror.patch')
sha256sums=('SKIP'
            '5338271504bb308ec80ca2b5879451b37aec52f6b3cc9919b7dabe454f1d1ce2'
            'f6aff7b48ade3876739a940de19cc404dca53331a19e15b95f825096d8b96d9c')

BUILDENV+=('!check')

BUILD_DIR=build

prepare() {
  cd ${_pkgname}
  git checkout xenial_-_edge_-_wayland

  sed -i 's/ubuntu-app-launch-2/ubuntu-app-launch-3/g' CMakeLists.txt
  patch -Np1 -i "${srcdir}/moc.patch"
  patch -Np1 -i "${srcdir}/nowerror.patch"
}

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

build() {
  cd ${_pkgname}
  mkdir -p ${BUILD_DIR}
  cd ${BUILD_DIR}
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" ..
  make
}

check() {
  cd ${_pkgname}/${BUILD_DIR}
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}/${BUILD_DIR}
  make DESTDIR="${pkgdir}/" install
  mv ${pkgdir}/usr/lib/qt5/ ${pkgdir}/usr/lib/qt/
}
# vim:set ts=2 sw=2 et:
